#ifndef __MONKEY__H__
#define __MONKEY__H__

#include "cocos-ext.h"
#include "cocos2d.h"
#include "Config.h"

USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocos2d::gui;


class Monkey : public CCNode
{
public:

	/// 
	/// Khoi tao con khi
	/// 
	/// Kiem tra va khoi tao con khi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	static Monkey * create();

	/// 
	/// addchild armature
	/// 
	/// Gan armature voi cac hanh dong cua con khi vao class
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	bool init();

	/// 
	/// update
	/// 
	/// update cac trang thai, huong cua con khi khi thay doi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	virtual void update(float dt);

	/// 
	/// Draw
	/// 
	/// Draw bouding box around the monkey
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	virtual void draw();

	/// 
	/// load music
	/// 
	/// phan am thanh
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fPreLoadMusic();

	/// 
	/// setter, geteter luong mau
	///
	/// numheath: luong mau can thay doi
	/// 
	/// SetHeath: thay doi luong mau hien tai cua khi
	/// GetHeath: tra ve luong mau hien tai cua khi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline void fSetHeath(int numheath){mHeath = numheath;}
	inline int fGetHeath(){return mHeath;}

	///
	/// Setter, Geteter trang thai hien tai cua con khi
	/// 
	/// status: trang thai can thay doi
	///
	/// SetStatus: thay doi trang thai hien tai cua khi
	/// GetStatus: tra ve trang thai hien tai cua khi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline void fSetStatus(Status status) {mNewStatus = status;}
	inline int fGetStatus() {return mCurrentStatus;}

	///
	/// Setter, Geteter trang thai xoay ben phai hay ben trai cua cay
	/// 
	/// direction: huong xoay can thay doi
	///
	/// SetDirection: Thay doi huong xoay hien tai
	/// GetDirection: Tra ve huong xoay hien tai
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline void fSetDirection(int direction) {mNewDirection = direction;}
	inline int fGetDirection() {return mCurrentDirection;};

	/// 
	/// get armature
	/// 
	/// tra ve armature gom cac hanh dong cua con khi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	inline CCArmature* fGetArmature(){return mArmature;}

	/// 
	/// change direction
	///
	/// Thay doi huong xoay hien tai cua con khi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fChangeDirection();
	void fRunChangeDirection(float widthtree);

	/// 
	/// decrease heath
	/// 
	/// delta: thoi gian chay lai ham
	///
	/// giam luong mau theo thoi gian delta
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fDecreaseHeath(float delta);

	/// 
	/// increase heath
	/// 
	/// type: loai qua an duoc
	///
	/// tang luong mau tuong ung khi qua duoc qua
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///

	void fIncreaseHeath(int type);
	
	/// 
	/// effect
	/// 
	/// Cac hanh dong tuong ung voi tung trang thai cua con khi
	/// 
	///
	/// @author 
	/// time_create:
	/// time_end:
	///
	void fEffect();


private:

	CCArmature* mArmature; // chua animation con khi
	int mHeath; // luong mau
	float mScale; //can chinh ti le

	// Cac trang thai cua con khi
	int mCurrentStatus; //trang thai hien tai
	int mNewStatus; // trang thai moi

	int mCurrentDirection; // huong hien tai
	int mNewDirection; //huong moi

};

#endif //Khi con